﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApp8
{
    
    public  class DbHeiper
    {
        public static readonly string conString = "server=.;database=Blogs;uid=sa;pwd=1";
        public static DataTable GetDataTable (String SQL)
        {
            SqlConnection connection = new SqlConnection(conString);
            SqlDataAdapter adapter = new SqlDataAdapter(SQL, connection);
            DataTable dt = new DataTable();
            connection.Open();
            adapter.Fill(dt );
            return dt;
        }
        public static int AddOrUpdaterOrDelete(string sql)
        {
            SqlConnection connection = new SqlConnection(conString);
            SqlCommand command = new SqlCommand(sql, connection);
            connection.Open();
            return  command.ExecuteNonQuery();
        }
        
    }
}
